require(['dialogDetail', 'baseLayout', 'common', 'request'], function (DialogDetail, BaseLayout, common, Request) {
    var dialogDetail = new DialogDetail({
        winCallback: 'win_dev_data_backup_config_detail_callback',
        formId: 'frm',
        getUrl: 'api/dev/data/backup/config/{id}',
        addUrl: 'api/dev/data/backup/config',
        updateUrl: 'api/dev/data/backup/config',
        selectParams: {
            fromTable: {
                id: 'fromTable',
                value: 'fromTable',
                text: 'fromTable',
                isInitLoadData: true,
                ajaxParam: {
                    url: "api/dev/table/list"
                },
                selectValueField: 'name',
                selectTextField: 'name',
                dataAction: 'server',
                defaultSelectType: 'value',
                width: 180,
                placeholder: '请选择数据源表',
                onChange: function (value, text) {
                    if (dialogDetail) {
                        dialogDetail.selLoadServerData('timeColumn');
                    }
                }
            },
            toTable: {
                id: 'toTable',
                value: 'toTable',
                text: 'toTable',
                isInitLoadData: true,
                ajaxParam: {
                    url: "api/dev/table/list"
                },
                selectValueField: 'name',
                selectTextField: 'name',
                dataAction: 'server',
                defaultSelectType: 'value',
                width: 180,
                placeholder: '请选择数据备份表',
            },
            timeColumn: {
                id: 'timeColumn',
                value: 'timeColumn',
                text: 'timeColumn',
                isInitLoadData: false,
                ajaxParam: {
                    url: "api/dev/table/columns/list",
                    data: function () {
                        if (dialogDetail && dialogDetail["fromTable"]) {
                            var toTable = dialogDetail["fromTable"].getSelectedValue();
                            return {keyword: toTable};
                        }
                    }
                },
                selectValueField: 'name',
                selectTextField: 'name',
                dataAction: 'server',
                defaultSelectType: 'value',
                width: 180,
                placeholder: '请选择时间字段'
            }
        }
    })


});